<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="*|/"><xsl:apply-templates/></xsl:template>

<xsl:template match="text()|@*"><xsl:value-of select="."/></xsl:template>

<xsl:template match='nbsp' name='nbsp'>
<xsl:text disable-output-escaping='yes'>&amp;nbsp;</xsl:text>
</xsl:template>

<xsl:template match="Registration[@step=1]">

<div style="padding-left:20px;"><h3><xsl:value-of select="/Registration/Question[@ID=4]/Answer[@ID=/Registration/@place]"/>!</h3></div>
<div style="padding:20px;padding-top:40px;float:left; width:400px;">Crea una serata in <font style="color:red;"><strong><u>discoteca</u></strong></font> per ballare e divertirti fino all'alba!</div>
<div style="padding:0px; width:140px;"><img border="0" src="/imgs/icona_disco.gif"/></div>
<div style="padding:20px;padding-top:40px;float:left; width:400px;"><a class="black" href="/activities/activityCreate2nd.aspx?step=2&amp;categoryid=1200&amp;place={@place}">Crea un <font style="color:red;"><strong><u>aperitivo</u></strong></font> per fare nuove conoscenze davanti ad un Drink e tanti stuzzichini!</a></div>
<div style="padding:10px; width:140px; padding-left:25px;"><a class="black" href="/activities/activityCreate2nd.aspx?step=2&amp;categoryid=1200&amp;place={@place}"><img border="0" src="/imgs/actaper.gif"/></a></div>
<div style="padding:20px;padding-top:40px;float:left; width:400px;">Organizza una <font style="color:red;"><strong><u>cena</u></strong></font> dove degustare in compagnia tante prelibatezze!</div>
<div style="padding:10px; width:140px; padding-left:10px;"><img src="/imgs/actdinner.gif"/></div>
<div style="padding:20px;">Crea un evento di diversa tipologia cliccando qui!</div>
</xsl:template>

<xsl:template match="Registration">
<!-- Insert appropriate Validation -->
<xsl:variable name="PWID" select='/Question[(@Type="12")]
											 /@RP3'/>

<script>
function validateForm() {
document.returnValue = true;
<xsl:for-each select="Question">
	<xsl:if test='@Type!="8"'>
		<xsl:if test='@Type="3"'>
			var ric = document.getElementById("R5").value;
			var che = document.getElementById("R5").checked;
			if( ric=="894" )
			if( che==false ) {
				var gg = document.getElementById("gg<xsl:value-of select="@ID"/>").value;
				var mm = document.getElementById("mm<xsl:value-of select="@ID"/>").value;
				var aa = document.getElementById("aaaa<xsl:value-of select="@ID"/>").value
				if (isDate(	gg, mm, aa)){
					document.returnValue = true;
				}else{
					alert("Inserisci una data dell'evento valida, dai!");
					document.returnValue = false;
				}
			}
		</xsl:if>

		<xsl:if test='@Type="11"'>
			isUsername(document.getElementById("T<xsl:value-of select="@ID"/>").value);
		</xsl:if>


	</xsl:if>
</xsl:for-each>
}
</script>
<!-- End of Insert appropriate Validation -->
<table class="gbox" border="0" cellspacing="0" cellpadding="8" width="100%">
<form name="formRegistration" method="post" action="/activities/activityCreate.aspx" onSubmit="validateForm();return document.returnValue">
<tr>
<input type="hidden" name="FORM_ID" value="{concat('FORM',@ID)}"></input>
<td colspan="4">
</td>
</tr>

<xsl:variable name="nextForm">
<xsl:for-each select="Question">
<xsl:choose>
	<xsl:when test='@Type="16"'>
			<xsl:value-of select="@P1"/>
	</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:variable>

<xsl:for-each select="Question">
<xsl:choose>
	<xsl:when test='@Type="16"'>
		<xsl:variable name="next">
			<xsl:value-of select="@P1"/>
		</xsl:variable>
	</xsl:when>
	<xsl:when test='@Type="15"'>
		<tr><td colspan="4" align="center">
		<a href="{@P3}"><xsl:value-of select="@Description"/></a>
		<br/><span class="body_10px_red"><xsl:value-of select="@Comment"/></span>
		</td></tr>
	</xsl:when>
	<xsl:when test='@Type="14"'>
		<tr><td colspan="4" align="center">
		<input id="SB{@ID}" name="SB{@ID}" onClick="javascript:link('{@P3}');" type="button" value="{@Description}"></input>
		<br/><span class="body_10px_red"><xsl:value-of select="@Comment"/></span>
		</td></tr>
	</xsl:when>
	<xsl:when test='@Type="8"'>
		<tr><td colspan="4" align="center">
		<input type="hidden" name="nextForm" value="{$nextForm}"></input>
		<br/><input type="submit" name="{concat('SUBMIT',@ID)}" value="{@Description}"></input><br/>
		</td></tr>
	</xsl:when>
	<xsl:when test='@Type="9"'>
		<tr><td colspan="4" align="center"><h4><xsl:value-of select="@Description"/></h4></td></tr>
	</xsl:when>
	<xsl:when test='@Type="10" and @P1="0"'>
		<tr><td colspan="4" align="left"><xsl:value-of select="@Comment"/></td></tr>
		<tr><td colspan="4" align="left"></td></tr>
	</xsl:when>
	<xsl:when test='@Type="10" and @P1="1"'>
		<tr><td colspan="3"></td>
			<td colspan="1" align="left"><xsl:value-of select="@Comment"/></td></tr>
		<tr><td colspan="4" align="left"></td></tr>
	</xsl:when>
	<xsl:when test='@Type="2" and @ID="6"'>
		<input type="hidden" value="1198" name="R6"></input>
	</xsl:when>
	<xsl:when test='@Type="2" and @ID="14"'>
		<tr>
		<td width="200px">
		<div style="float:left;"><img src="/imgs/argh.gif"/></div><div style="padding-top:6px;"><xsl:value-of select="@Description"/></div>
		</td>
		<td align="right"></td>
		<td></td>
		<td>
		<table>
		<xsl:variable name="radioID" select="concat('R',@ID)"></xsl:variable>

		<xsl:choose>
		<xsl:when test='@P1="1"'>
			<tr>
			<xsl:for-each select="Answer">
				<xsl:choose>
				  <xsl:when test='@Selected="1"'><td><input type="radio" checked="yes" value="{@ID}" name="{$radioID}"></input></td></xsl:when>
				  <xsl:when test='@Selected="0"'><td><input type="radio" value="{@ID}" name="{$radioID}"></input></td></xsl:when>
				</xsl:choose>
				<td class="body"><xsl:value-of select="."/></td>
			</xsl:for-each>
			</tr>
		</xsl:when>
		<xsl:when test='@P1="2"'>
			<xsl:for-each select="Answer">
				<tr>
					<xsl:choose>
					  <xsl:when test='@Selected="1"'><td><input type="radio" checked="yes" value="{@ID}" name="{$radioID}"></input></td></xsl:when>
					  <xsl:when test='@Selected="0"'><td><input type="radio" value="{@ID}" name="{$radioID}"></input></td></xsl:when>
					</xsl:choose>
				<td class="body"><xsl:value-of select="."/></td>
				</tr>
			</xsl:for-each>
		</xsl:when>
		</xsl:choose>

		</table>
		</td>
		</tr>
	</xsl:when>
	<xsl:when test='@Type="X1" and @ID="15" and @Hidden'>
		<input type="hidden" name="LID" value="{/Registration/@lid}"></input>
				<div style="float:left;"><input type="hidden" name="{concat('T',@ID)}" size="22" maxlength="255" value="{/Registration/@name}"></input></div>
	</xsl:when>
	<xsl:when test='@Type="X1" and @ID="15"'>
		<tr>
		<td width="200px"><xsl:value-of select="@Description"/></td>
		<td align="right"></td>
		<td></td>
		<td>
			<xsl:choose>
				<xsl:when test='/Registration/@lid'>
				<div style="float:left;"><input type="text" name="{concat('T',@ID)}" size="22" maxlength="255" disabled="true" value="{/Registration/@name}"></input></div>
					<div style="float:left;padding-top:4px;">&#160;&#160;(<a href="/activities/activityCreate.aspx?chooselid=1">Cambia locale!</a>)</div>
					<div style="padding-top:2px;">&#160;&#160;<a href="/activities/activityCreate.aspx"><img border="0" src="/imgs/delete.gif"/></a></div>
				</xsl:when>
				<xsl:otherwise>
				<input type="text" name="{concat('T',@ID)}" size="22" maxlength="255" disabled="true" value="Nessun locale selezionato!"></input>
					&#160;(<a href="/activities/activityCreate.aspx?chooselid=1">Seleziona un locale!</a>)
				</xsl:otherwise>
			</xsl:choose>
		</td>
		</tr>
	</xsl:when>
	<xsl:when test='@Type="5" and @ID=9 and @Hidden'>
		<input type="hidden" name="T{@ID}" value="{concat(/Registration/@name,' - ',/Registration/@address)}"></input>
	</xsl:when>
	<xsl:when test='/Registration/@lid and @ID=10  and @Hidden'>
		<input type="hidden" name="T{@ID}" value="{/Registration/@mapid}"></input>
	</xsl:when>

	<xsl:otherwise>
		<tr>
		<td>
		<xsl:value-of select="@Description"/>
		</td><td align="right">
		</td><td>

		</td>
		<td>

		<xsl:if test='@Type="7"'>
		<xsl:variable name="TMPID" select="@ID"></xsl:variable>
			<xsl:for-each select='Answer'>
			<table cellspacing="0" cellpadding="0">
				<xsl:if test='@Type="4"'>
					<tr><td><input type="text" name='SE{../@ID}' size="35" maxlength="64"></input></td></tr>
				</xsl:if>
				<xsl:if test='@Type="1"'>
					<tr><td>
					<select class="body" size="1" name="{concat('SD',@ID)}">
					<xsl:for-each select="SubAnswer">
					<option value="{@ID}"><xsl:value-of select="."/></option>
					</xsl:for-each>
					</select>
					</td></tr>
				</xsl:if>
			</table>
			</xsl:for-each>
		</xsl:if>

		<xsl:if test='@Type="1"'>
				<xsl:choose>
					<xsl:when test='/Registration/@lid and @ID=4'>
<input type="hidden" name="D{@ID}" value="{/Registration/@place}"></input>
<div style="float:left; padding-right:10px;">
	<xsl:choose>
	<xsl:when test='string-length(/Registration/@mapid)&gt;0'>
		<!-- INIZIO MAPORAMA -->
		<div style="padding-top:3px;">
		<b><a target="_blank" href="http://www.maporama.com/share/map.asp?MapID={/Registration/@mapid}&amp;language=it"><img border="0" src="/imgs/gpMap55w.gif"/></a></b>
		</div>
		<!-- FINE MAPORAMA -->
	</xsl:when>
	</xsl:choose>
</div>
<div class="title">
<xsl:value-of select="/Registration/@name"/>
<br/>
<div style="padding-top:3px;">
<a class="black" target="_blank" href="http://www.maporama.com/share/map.asp?MapID={/Registration/@mapid}&amp;language=it"><xsl:value-of select="/Registration/@address"/></a>
</div>
</div>
					</xsl:when>
					<xsl:when test='@Disabled'>
							<input type="hidden" name="D{@ID}" value="{/Registration/@categoryid}"></input>
							<select disabled="{@Disabled}" class="body" size="1" name="DD{@ID}">
							<xsl:for-each select="Answer">
								<xsl:choose>
									<xsl:when test='/Registration/@categoryid = @ID'>
										<option selected="selected" value="{@ID}"><xsl:value-of select="."/></option>
									</xsl:when>
									<xsl:otherwise>
										<option value="{@ID}"><xsl:value-of select="."/></option>
									</xsl:otherwise>
								</xsl:choose>
							</xsl:for-each>
							</select>
					</xsl:when>
					<xsl:otherwise>
							<select class="body" size="1" name="D{@ID}">
							<xsl:for-each select="Answer">
							<option value="{@ID}"><xsl:value-of select="."/></option>
							</xsl:for-each>
							</select>
					</xsl:otherwise>
				</xsl:choose>
		</xsl:if>

		<xsl:if test='@Type="2"'>
		<table>
		<xsl:variable name="radioID" select="concat('R',@ID)"></xsl:variable>

		<xsl:choose>
		<xsl:when test='@P1="1"'>
			<tr>
			<xsl:for-each select="Answer">
				<xsl:choose>
				  <xsl:when test='@Selected="1"'><td><input type="radio" checked="yes" value="{@ID}" name="{$radioID}"></input></td></xsl:when>
				  <xsl:when test='@Selected="0"'><td><input type="radio" value="{@ID}" name="{$radioID}"></input></td></xsl:when>
				</xsl:choose>
				<td class="body"><xsl:value-of select="."/></td>
			</xsl:for-each>
			</tr>
		</xsl:when>
		<xsl:when test='@P1="2"'>
			<xsl:for-each select="Answer">
				<tr>
					<xsl:choose>
					  <xsl:when test='@Selected="1"'><td><input type="radio" checked="yes" value="{@ID}" name="{$radioID}"></input></td></xsl:when>
					  <xsl:when test='@Selected="0"'><td><input type="radio" value="{@ID}" name="{$radioID}"></input></td></xsl:when>
					</xsl:choose>
				<td class="body"><xsl:value-of select="."/></td>
				</tr>
			</xsl:for-each>
		</xsl:when>
		</xsl:choose>

		</table>
		</xsl:if>

		<xsl:if test='@Type="3"'><nobr>
		<input type="text" id="{concat('gg',@ID)}" name="{concat('gg',@ID)}" class="form" size="2" maxlength="2"></input>
		/
		<input type="text" id="{concat('mm',@ID)}" name="{concat('mm',@ID)}" class="form" size="2" maxlength="2"></input>
		/
		<input type="text" id="{concat('aaaa',@ID)}" name="{concat('aaaa',@ID)}" class="form" size="4" maxlength="4"></input></nobr>
		<div class="body_10px_red"><xsl:value-of select="@Comment"/></div>
		</xsl:if>

		<xsl:if test='@Type="31"'><nobr>
		<input type="text" id="{concat('hh',@ID)}" name="{concat('hh',@ID)}" class="form" size="2" maxlength="2"></input>
		:
		<input type="text" id="{concat('mi',@ID)}" name="{concat('mi',@ID)}" class="form" size="2" maxlength="2"></input></nobr>
		<div class="body_10px_red"><xsl:value-of select="@Comment"/></div>
		</xsl:if>

		<xsl:if test='@Type="41"'>
			<img src="/imgs/girl.gif"/>&#160;<input type="text" name="{concat('T',@ID)}" size="5" maxlength="5"></input>&#160;<input onchange="document.forms[0].{concat('T',@ID)}.disabled=document.forms[0].{concat('CB',@ID)}.checked" type="checkbox" name="{concat('CB',@ID)}">Free</input>
		</xsl:if>
		<xsl:if test='@Type="42"'>
			<img src="/imgs/boy.gif"/>&#160;<input type="text" name="{concat('T',@ID)}" size="5" maxlength="5"></input>&#160;<input onchange="document.forms[0].{concat('T',@ID)}.disabled=document.forms[0].{concat('CB',@ID)}.checked" type="checkbox" name="{concat('CB',@ID)}">Free</input>
		</xsl:if>

		<xsl:if test='@Type="4"'>
			<input type="text" id="{concat('E',@ID)}" name="{concat('E',@ID)}" size="35" maxlength="64"></input>
			<br/><span class="body_10px_red"><xsl:value-of select="@Comment"/></span>
		</xsl:if>

		<xsl:choose>
			<xsl:when test='@Type="5"'>
				<xsl:choose>
					<xsl:when test='/Registration/@lid and @ID=9'>
							<input type="hidden" name="LID" value="{/Registration/@lid}"></input>
							<input type="hidden" name="T{@ID}" value="{concat(/Registration/@name,' - ',/Registration/@address)}"></input>
							<input disabled="true" type="text" name="{concat('TTT',@ID)}" size="{@P2}" maxlength="{@P1}" value="{concat(/Registration/@name,' - ',/Registration/@address)}"></input>
							<br/><span class="body_10px_red"><xsl:value-of select="@Comment"/></span>
					</xsl:when>
					<xsl:when test='/Registration/@lid and @ID=10'>
							<input type="hidden" name="T{@ID}" value="{/Registration/@mapid}"></input>
							<input disabled="true" type="text" name="{concat('TTT',@ID)}" size="{@P2}" maxlength="{@P1}" value="{/Registration/@mapid}"></input>
							<br/><span class="body_10px_red"><xsl:value-of select="@Comment"/></span>
					</xsl:when>
					<xsl:otherwise>
							<input type="text" name="{concat('T',@ID)}" size="{@P2}" maxlength="{@P1}"></input>
							<br/><span class="body_10px_red"><xsl:value-of select="@Comment"/></span>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:when>
		</xsl:choose>

		<xsl:if test='@Type="11"'>
			<input type="text" ID="T{@ID}" name="NICK{@ID}" size="{@P2}" maxlength="{@P1}"></input>
			<br/><span class="body_10px_red"><xsl:value-of select="@Comment"/></span>
		</xsl:if>

		<xsl:if test='@Type="12"'>
			<input type="password" ID="T{@ID}" name="PW{@ID}" size="{@P2}" maxlength="{@P1}"></input>
			<br/><span class="body_10px_red"><xsl:value-of select="@Comment"/></span>
		</xsl:if>

		<xsl:if test='@Type="13"'>
			<TEXTAREA id="TA{@ID}" name="TA{@ID}" rows="{@P1}" cols="{@P2}"></TEXTAREA>
			<br/><span class="body_10px_red"><xsl:value-of select="@Comment"/></span>
		</xsl:if>

		<xsl:if test='@Type="6"'>
			<img src="{@Comment}" border="1"/>
		</xsl:if>

		</td>
		</tr>
	</xsl:otherwise>
</xsl:choose>

</xsl:for-each>


</form>
</table>
</xsl:template>

</xsl:stylesheet>